package cn.tedu.imop.basic.service.impl;

import cn.tedu.imop.basic.dao.repository.MemberGroupRepository;
import cn.tedu.imop.basic.entity.MemberGroup;
import cn.tedu.imop.basic.service.MemberGroupService;
import cn.tedu.imop.common.pojo.PageData;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(readOnly = false,
               rollbackFor = RuntimeException.class,
               noRollbackFor = IllegalArgumentException.class,
               isolation = Isolation.READ_COMMITTED,
               timeout = 60,
               propagation = Propagation.REQUIRED)
public class MemberGroupServiceImpl implements MemberGroupService {

    private MemberGroupRepository memberGroupRepository;

    public MemberGroupServiceImpl(MemberGroupRepository memberGroupRepository) {
        this.memberGroupRepository = memberGroupRepository;
    }
    @Override
    public Boolean createMemberGroup(MemberGroup memberGroup) {
        memberGroupRepository.insertMemberGroup(memberGroup);
        return true;
    }

    @Override
    public PageData<MemberGroup> getMemberGroupList(MemberGroup memberGroup) {
        return memberGroupRepository.selectMemberGroupList(memberGroup);
    }
}
